home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
program
/
gcc
/
gcc270-d.lha
/
gnu
/
man
/
cat3
/
funopen.0
< prev
next >
Wrap
Text File
|
1992-08-10
|
4KB
|
133 lines
FUNOPEN(3) UNIX Programmer's Manual FUNOPEN(3)
NNAAMMEE
ffuunnooppeenn, ffrrooppeenn, ffwwooppeenn - open a stream
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssttddiioo..hh>>
_F_I_L_E _*
ffuunnooppeenn(_v_o_i_d _*_c_o_o_k_i_e, _i_n_t _(_*_r_e_a_d_f_n_)_(_v_o_i_d _*_, _c_h_a_r _*_, _i_n_t_),
_i_n_t _(_w_r_i_t_e_f_n_*_)_(_v_o_i_d _*_, _c_o_n_s_t _c_h_a_r _*_, _i_n_t_),
_f_p_o_s___t _(_s_e_e_k_f_n_*_)_(_v_o_i_d _*_, _f_p_o_s___t_, _i_n_t_), _i_n_t _(_c_l_o_s_e_f_n_*_)_(_v_o_i_d _*_))
_F_I_L_E _*
ffrrooppeenn(_v_o_i_d _*_c_o_o_k_i_e, _i_n_t _(_*_r_e_a_d_f_n_)_(_v_o_i_d _*_, _c_h_a_r _*_, _i_n_t_))
_F_I_L_E _*
ffwwooppeenn(_v_o_i_d _*_c_o_o_k_i_e, _i_n_t _(_*_w_r_i_t_e_f_n_)_(_v_o_i_d _*_, _c_h_a_r _*_, _i_n_t_))
DDEESSCCRRIIPPTTIIOONN
The ffuunnooppeenn() function associates a stream with up to four ``I/O
functions''. Either _r_e_a_d_f_n or _w_r_i_t_e_f_n must be specified; the others can
be given as an appropriatelytyped NULL pointer. These I/O functions
will be used to read, write, seek and close the new stream.
In general, omitting a function means that any attempt to perform the as
sociated operation on the resulting stream will fail. If the close func
tion is omitted, closing the stream will flush any buffered output and
then succeed.
The calling conventions of _r_e_a_d_f_n, _w_r_i_t_e_f_n, _s_e_e_k_f_n and _c_l_o_s_e_f_n must match
those, respectively, of read(2), write(2), seek(2), and close(2) with
the single exception that they are passed the _c_o_o_k_i_e argument specified
to ffuunnooppeenn() in place of the traditional file descriptor argument.
Read and write I/O functions are allowed to change the underlying buffer
on fully buffered or line buffered streams by calling setvbuf(3). They
are also not required to completely fill or empty the buffer. They are
not, however, allowed to change streams from unbuffered to buffered or to
change the state of the line buffering flag. They must also be prepared
to have read or write calls occur on buffers other than the one most re
cently specified.
All user I/O functions can report an error by returning -1. Additional
ly, all of the functions should set the external variable _e_r_r_n_o appropri
ately if an error occurs.
An error on cclloosseeffnn() does not keep the stream open.
As a convenience, the include file <_s_t_d_i_o_._h> defines the macros ffrrooppeenn()
and ffwwooppeenn() as calls to ffuunnooppeenn() with only a read or write function
specified.
RREETTUURRNN VVAALLUUEESS
Upon successful completion, ffuunnooppeenn() returns a FILE pointer. Otherwise,
NULL is returned and the global variable _e_r_r_n_o is set to indicate the er
ror.
EERRRROORRSS
[EINVAL] The ffuunnooppeenn() function was called without either a read or
write function. The ffuunnooppeenn() function may also fail and set
_e_r_r_n_o for any of the errors specified for the routine
malloc(3).
SSEEEE AALLSSOO
fcntl(2), open(2), fclose(3), fopen(3), fseek(3), setbuf(3)
HHIISSTTOORRYY
These functions are currently under development.
BBUUGGSS
The ffuunnooppeenn() function may not be portable to systems other than BSD
UNIX.
BSD Experimental April 19, 1991 2